<?php
use Yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\widgets\LinkPager;
use yii\helpers\Url;
$this->title = '喜欢的教师';
?>
<?php echo $this->render('_centerHeader') ?>
<!--主体开始-->
<div class="main-area" style=" background: #f5f5f5;">
    <div class="container">
        <div class="column-layout">
            <!-- main-area-left start  -->
<div class="column-col column-full main-area-left">
<div class="main-area-leftin tab-box">
<div class="ibox">
    <div class="ibox-in">
        <div class="ibox-head">
            <ul class="tab-list" role="tablist">
                <li role="presentation" class="active">
                    <a href="#BASIC_DOC" aria-controls="BASIC_DOC" role="tab" data-toggle="tab">喜欢的教师</a>
                </li>
            </ul>
        </div>
        <div class="row my-fansfriend-list">
	<!-- item  -->
	<?php if($teacher != ''){?>
	<?php foreach($teacher as $k=>$v){?>
		<div class="item col-xs-6">
		<div class="col-in">
			<div class="column-layout">
				<div class="column-col">
					<span class="u-photo u-photot-btn"><img src="http://files.bwphp.com/file/image/show/50/50?path=<?php echo $v['teacher_thumb']?>" alt=""></span>
				</div>
				<div class="column-col column-full">
					<div class="column-layout">
						<div class="column-col-l">
							<span class="u-name">
								<a href="<?= Url::to(['teacher/teacherinfo'])?>?teacher_id=<?php echo $v['teacher_id']?>" target="_blank">
								<?php echo $v['teacher_name']?>
								
								</a>
							</span>
						</div>
						<div class="column-col-r">
							<div class="dropdown">
								
									<a id="" data-target="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">已喜欢<span class="caret"></span></a>
									<a href="javascript:void(0)" teacher_id="<?php echo $v['teacher_id']?>" class='delteacher'>点击取消</a>								
							</div>
						</div>
					</div>
					<div class="row">
						<p>来自：<span class="en-text"><?php echo $v['from_name']?></span></p>
						<p>是一名：<span class="en-text"><?php echo $v['position_name']?></span></p>
						
					</div>
					<p class="u-title"><?php echo $v['teacher_at']?></p>
					<p class="u-introduction"><?php echo $v['teacher_desc']?>
						
					</p>
				</div>
			</div>
		</div>
	</div>
	<?php }?>
	<?php }else{ echo "<h1><center>您当前还没有喜欢的教师</center></h1>";}?>
</div>
	<?php echo LinkPager::widget([
				'pagination' => $pagination,
				'prevPageLabel'=>'上一页',
				'nextPageLabel'=>'下一页',
			]);?></div></div></div>
</div>
            <!-- main-area-left end  -->
            <!-- main-area-right start  -->
            <div dy-v="00-00-11-11" class="column-col main-area-right">
                
                <!-- 课程推荐 -->
                <?php echo $this->render('../common/_courseRecommend') ?>
 
                <!-- 名师推荐 -->
                <?php echo $this->render('../common/_teacherRecommend') ?>

                <!-- 图片广告 -->
                <?php echo  $this->render('../common/_adRecommend') ?>
            </div>
            <!-- main-area-right end  -->
        </div>
    </div>
</div>
<script>
	$(".delteacher").click(function(){
		if(confirm("确定要取消对此教师的喜欢吗？"))
	    {
			var teacher_id = $(this).attr('teacher_id')
			$.ajax({
			   type: "POST",
			   url: "<?= Url::to(['center/delteacher'])?>",
			   data: "teacher_id="+teacher_id,
			   success: function(msg){
				 if(msg == 1){
					alert('取消成功')
					location.reload();
				 }
			   }
			});
	    }else{
			return false;
	    }
	})
</script>